package can;

public class Option {

	public String name;
	public String type;
	public Boolean isActive;
	
	public Option(String name, String type) {
		this.name = name;
		this.type = type;
		isActive = true;
	}
	
	public Option(String name, String type, Boolean isActive) {
		this.name = name;
		this.type = type;
		this.isActive = isActive;
	}
	
	public Option(String encodedOption) {
		this.name = 	encodedOption.substring(encodedOption.indexOf("[")+1,encodedOption.indexOf(","));
		this.type = 	encodedOption.substring(encodedOption.indexOf(",")+1,encodedOption.indexOf(",2"));
		this.isActive = Boolean.parseBoolean(encodedOption.substring(encodedOption.indexOf(",2")+2,encodedOption.indexOf("]")));
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Boolean getIsActive() {
		return isActive;
	}

	public void setIsActive(Boolean isActive) {
		this.isActive = isActive;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
	
	public String toString() {
		return "[" + name + "," + type + ",2" + isActive + "]";
	}
	
}
